<!-- eslint-disable vue/multi-word-component-names -->
<script setup>
import {onMounted, ref} from 'vue'
import TestCom from './TestCom.vue';

// 调用ref函数得到ref对象
const h1Ref = ref(null)
const comRef = ref(null)

// 组件挂载完毕之后才能获取
onMounted(() => {
  // <h1>我是dom标签h1</h1>
  console.log(h1Ref.value);
  console.log(comRef.value);
  
})


</script>

<template>
  <!-- 通过ref标识绑定ref对象 -->
   <h1 ref="h1Ref">我是dom标签h1</h1>
   <TestCom ref="comRef"></TestCom>
</template>
